﻿using System.Linq;
using eCommerce.Core.Data;
using eCommerce.Core.Domain.Brands;

namespace eCommerce.Services.Brands
{
    public interface IBrandService
    {
        Brand GetDefaultBrand();
    }

    public class BrandService : IBrandService
    {
        private IRepository<Brand> _brandRep;

        public BrandService(IRepository<Brand> brandRep)
        {
            _brandRep = brandRep;
        }

        public Brand GetDefaultBrand()
        {
            return _brandRep.Table.FirstOrDefault(c => c.Name == "default");
        }
    }
}